package org.openea.eap.module.obpm.model.form;

import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.NotEmpty;
import org.openbpm.base.core.model.BaseModel;
import org.openbpm.base.core.util.StringUtil;
import org.openbpm.form.api.model.IFormDef;

@Data
@Accessors(chain = false)
public class FormDef
        extends BaseModel
        implements IFormDef {

    private String type;  //pc_vue
    @NotEmpty
    private String key;
    @NotEmpty
    private String name;
    private String desc;
    private String groupId;  //所属分类
    private String groupName;
    private String boKey;
    private String boName;
    private String html;

    // 版本控制


    public String getHtml() {
        if (StringUtil.isNotEmpty(this.html)) {

            String content = this.html.replaceAll("&apos;", "'").replaceAll("&#39;", "'").replaceAll("#ctx#", "ctx");
            return content;
        }

        return this.html;
    }
}
